package 集合.day3.demo2;

import java.util.HashMap;
import java.util.Set;

public class Test {
    public static void main(String[] args) {
        String s="fewuiop234jofemru93w2fjklsfj";
        HashMap<Character,Integer> m=new HashMap<>();
        char c;
        for(int i=0;i<s.length();i++){
            c=s.charAt(i);
            if(m.containsKey(c)){
                m.put(c,m.get(c)+1);
            }else {
                m.put(c,1);
            }
        }
        Set<Character>keys=m.keySet();
        for(Character k:keys){
            System.out.println("字符"+k+"出现次数："+m.get(k));
        }
    }
}
